﻿﻿<%@ page pageEncoding="UTF-8" %>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head> 
	<title>CrecheBook</title>
	<!-- meta -->
	<meta name="description" content="">
	<meta name="author" content="M. Steve">
	<link rel="shortcut icon" href="favicon.ico">
	<meta charset="UTF-8">
	
	<!-- CSS-->
	<link rel="stylesheet" href="medias/css/core.css" type="text/css" media="screen">
	
	<!-- JS -->
	<script src="medias/javaScript/inputs.js"></script>
	
	<!-- Google MAPS -->
	<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
	
	<!-- JQuery -->
	<meta name="viewport" content="width=device-width, initial-scale=1"> 
	<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
	<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
	<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
	
</head> 
<body > 

	<%@ page import = "Creche.Bd.BD" %>
	<%@page import = "Creche.Main.Creche"%>
	<%@page import = "Creche.Admin.Administrateur" %>
	<%@page import = "Creche.Personne.Personne"%>
	<%@page import = "Creche.Donnees.Adresse"%>

	<%@page import = "java.util.ArrayList" %>
	<%@page import = "java.lang.String" %>
	<%@page import = "java.io.*" %>
	<%@page import = "java.util.*" %>
	<%@page import = "javax.servlet.*" %>
	<%@page import = "java.sql.Date" %>
	<%@page import = "java.text.SimpleDateFormat" %>
	<%@page import = "java.text.DateFormat" %>
	


	<div data-role="page">
	
		<div data-role="header">
		
			
			
			<div id="banniere">
				<br>
				<br>
				<h1 >CrecheBook</h1>
			</div>
			
			<div id="searchBox">
	
				<div class="ui-bar ui-bar-c">	
					<h2 id="nomCreche">
						<a href='search.jsp' rel='external' data-role='button' data-theme='c' data-corners='true' data-icon='home' data-inline='true'>Accueil</a>
						Administration
					</h2>
	
				 </div>
			 </div>
				
				
	 
		</div><!-- /header -->
	
		<div data-role="content">
			<!-- Modifier ici -->
			<div class="ui-grid-a">
				<div class="ui-block-a">
				
					<div id="menu">
			
							<a href="accueilAdmin.jsp"><p id="socialLink"><img src="medias/images/919406.jpg.png" width="50" height="50"/><span>Informations</span></p></a>
							<a href="inscriptions_adm.jsp"><p id="socialLink"><img src="medias/images/1367190697_sign-up_1_small.png" width="50" height="50"/><span>Inscriptions</span></p></a>
					<%
						// Redirection
						Administrateur admin = (Administrateur)request.getSession().getAttribute("session");
				
						if (admin != null) {
							if (admin.getStatut()) {
								out.print("<a href='code' data-ajax='false'><p id='socialLink'><img src='medias/images/key.png' width='50' height='50'/><span>Codes admin</span></p></a>");
							}
						}
						else response.sendRedirect("connexion");
					%>
					
					</div>
			
			
				</div><!-- /menu-->
				
				<div class="ui-block-b">
				
					<div class="ui-bar ui-bar-b" >
						<h2> Informations personnelles </h2>
					</div>
				
					<div id="informationGenerale">
		
													
					<%
						if (admin != null) {
							String infoCreche = "<p class='col'>";
							infoCreche += "<strong> ID : </strong>" + admin.getIdentifiant() +"<br/>";
							infoCreche += "<strong> Email : </strong>" + admin.getEmail()+"<br/>";
							infoCreche += "<strong> Ville : </strong>" + admin.getVille() +"</p>";
							
							infoCreche += "<p style='margin:auto;width:250px;'><a href='deconnexion' data-ajax='false'><input type='button' data-theme='a' value='D&#233;connexion' class='button1'></a></p>";
							out.print(infoCreche);
						}
					%>
						
					
		
				
					</div> 
				
				</div>	   <!-- /infoGenerale-->
	
			</div> <!-- /ui-block-b-->
			<br>
			
			<div class="ui-bar ui-bar-c">
				<h2> Nouvelles inscriptions </h2>
			</div>
			
			
			
			
			 <div id="actualitee">
			 
				<br>
				<br>
									
				<% 

					if (admin != null)
					{		
						// Charger les creches de la DB
						BD myBD = new BD();
						ArrayList<Creche> creches = (ArrayList<Creche>) myBD.getCreches();
						
							
						// Affichage
						if (creches != null)
						{
								
							for(Creche c : creches)
							{
							
								if (!c.getListPers().isEmpty())
								{

									for(Personne p : c.getListPers())
									{
										if ( (c.getAdresse().getVille()).equals(admin.getVille()))
										{
										
										
											String infoEnfant = "";
											Adresse adr =  p.getAdresse();
											infoEnfant += "<strong>Creche</strong><i><br> " ;
											infoEnfant += "Nom: " + c.getNom() + "<br>";
											infoEnfant += "Adresse: " + c.getAdresse().getAdresse() + "<br>";
											infoEnfant += "Ville: " + c.getAdresse().getVille() + "<br>";
											infoEnfant += "Code Postal: " + c.getAdresse().getCP() + "</i><br>";
				
											
											infoEnfant += "<br><p style='width:300px;margin:auto;'><a href=\"mailInscription_adm.jsp?enfant="+p.getNom() + " "+ p.getPrenom()+"&creche="+c.getNom()+"\"><input type='button' value='Répondre' class='button1'></a></p>";
	
											out.print( "<div data-role='collapsible' data-theme='b' data-content-theme='d' data-collapsed='false'><h4>" +p.getNom() + " " +   p.getPrenom()+"</h4><br><br>" +infoEnfant+ "</div>");
									

										}
									}
								}
							}
						}
					}
						
						
				%>
		
			</div><!-- /actualitee -->
			
			<br>
			<br>
			
			
				
	
			
		</div><!-- /content -->
	
		<div data-role="footer">
			
			<h4 style="margin:30px;">
				<strong> CrecheBook 2013</strong> <br>
				<a href="legal.jsp" data-ajax="false">Mentions&nbsp;l&eacute;gales</a>&nbsp;|&nbsp;
				<a href="connexion" data-ajax="false">Administateur</a>
			 </h4>
				
		</div><!-- /footer -->
	</div><!-- /page -->

</body>
</html>